package fr.SDroid.Graph;

import java.io.Serializable;
import java.util.ArrayList;

public class Station implements Serializable{
	
	/**
	 * To make Java Happy
	 */
	private static final long serialVersionUID = 1L;
	private Ligne _ligne;
	Integer _id;
	String _name;
	Double _latitude;
	Double _longitude;
	ArrayList<Station> _listLiens = new ArrayList<Station>();
	ArrayList<Station> _listCoresp = new ArrayList<Station>();
	Integer _distance;
	Station _from;
	Boolean _end;
	Boolean _init;
	
	
	public Station(Ligne ligne, Integer id, String name, Double latitude, Double longitude) {
		_ligne = ligne;
		_id = id;
		_name = name;
		_latitude = latitude;
		_longitude = longitude;
		_distance = Integer.MAX_VALUE;
		_from = null;
		_end = false;
		_init = false;
		
	}
	
	public Station(Ligne ligne, Integer id, String name, String latitude, String longitude) {
		this(ligne, id, name, Double.parseDouble(latitude), Double.parseDouble(longitude));
	}
	
	public void init() {
		_from = null;
		_init=true;
	}
	
	public Boolean isInit() {
		return _init;
	}
	
	public void addLien(Station station) {
		_listLiens.add(station);
	}
	
	public void addCoresp(Station station) {
		_listCoresp.add(station);
	}
	
	public void setDistance(Integer distance) {
		_distance = distance;
		_from = null;
	}
	
	public Integer getDistance() {
		return _distance;
	}
	
	public ArrayList<Station> getFils() {
		return _listLiens;
	}
	
	public ArrayList<Station> getCoresp() {
		return _listCoresp;
	}

	public void setDistance(Integer distance, Station from) {
		_distance = distance;
		_from = from;
	}
	
	public void setEnd(Boolean end) {
		_end = end;
	}
	
	public Boolean getEnd() {
		return _end;
	}
	
	public String getName() {
		return _name;
	}
	
	public Ligne getLigne() {
		return _ligne;
	}
	
	public Integer getId() {
		return _id;
	}
	
	public Double getLatitude() {
		return _latitude;
	}
	
	public Double getLongitude() {
		return _longitude;
	}
	
	public Station getFrom() {
		return _from;
	}
}
